<template>
  <div class="big-box">
    <Top></Top>
    <Banner id="1"></Banner>
    <chamber></chamber>
    <NaTural></NaTural>
    <Business></Business>
    <Congra></Congra>
    <Tabbar></Tabbar>
  </div>
</template>

<script>
import Top from "../../components/Home/TopPage.vue";
import Banner from "@/components/Home/BannerView.vue";
import chamber from "@/components/Home/CommCe.vue";
import NaTural from "@/components/Home/NaTural.vue";
import Business from "@/components/Home/BusiNess.vue";
import Congra from "@/components/Home/CongraTulate.vue";
import Tabbar from "@/components/public/TabbleView.vue";
export default {
  components: {
    Top,
    Banner,
    chamber,
    NaTural,
    Business,
    Congra,
    Tabbar,
  },
  //底部栏的高亮
  created() {
    sessionStorage.setItem("active", 0);
  },
  mounted() {
    if (sessionStorage.getItem("province")) {
    } else {
      this.city();
    }
  },
  methods: {
    //定义获取城市方法
    city() {
      const geolocation = new BMap.Geolocation();
      var _this = this;
      geolocation.getCurrentPosition(
        function getinfo(position) {
          let city = position.address.city; //获取城市信息
          let province = position.address.province; //获取省份信息
          _this.LocationPCity = province;
          _this.LoPCity = province.substring(0, 2);
          sessionStorage.setItem("province", province);
          sessionStorage.setItem("provincesub", province.substring(0, 2));
          //  _this.LocationPCity = province + ' '  + city   //获取省市地址
          //    console.log("LocationPCity:", _this.LocationPCity, position)
        },
        function (e) {
          _this.LocationPCity = "定位失败,请退出页面重新定位";
        },
        { provider: "baidu" }
      );
    },
  },
};
</script>

<style scoped>
.big-box {
  width: 100%;
  /* height: 100%; */
  /* background-color: #f0eff5; */
}

</style>